Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add ability to copy comment link #981

Merged
merged 1 commit into from
Sep 15, 2024

Conversation

indyteo
Copy link
Contributor

@indyteo indyteo commented Jul 21, 2021

Feature request: Ability to copy comments permalink

As mentioned in the post, it is inspired by GitHub's "Copy Link" feature on comments.

It first add a unique link for each comment, based on their ID.
For example, my reply on this post has the ID #31419, so the link would look like :

https://feedback.fider.io/posts/317/ability-to-copy-comments-permalink#comment-31419

Then, it add the corresponding HTML id attribute on a wrapping div around comments, so the page automatically scroll to the targeted comment.
On the other hand, it also create a highlighted state in the ShowComment component that slightly mutate the comment background (a bit darker than others) to stand out. When a click is performed outside of the comment's area, it get back to normal and the hash is removed from the URL (the part after the #).

Highlighted comment

Finally, an action in the comment's drop down, target the current comment (set the URL in the navigation bar, triggering the comment highlight and scroll), and copy that link into the user's clipboard. A feedback indicate whether the copy was successful or not (due to the lack of support of the Clipboard API by some old outdated browsers), and invite people to manually copy their page's URL if not.

Copy link button

If the hash don't match anything is simply get ignored, and if it looks like a comment reference but we're unable to find it, a notice is shown to the user, because it may happen when the original comment got deleted, or the URL was manually modified and is now invalid. It get instantly cleaned up to avoid further share of a partially invalid link.


I never really played with URL's hash before and found it funny to do this, this is why I decided to train with this idea, even if it only has 2 votes (which means none, except from the submitter and me 😆), and it only took me about an hour so it was fun 😄

@indyteo indyteo changed the title Comment link feature: add ability to copy comment link Jul 21, 2021
@almereyda
Copy link

@indyteo Would you like to rebase this branch on main, or merge it again?

Then we could try to find someone for a review. Eventually you can also request a review?

@indyteo
Copy link
Contributor Author

indyteo commented Oct 26, 2022

Hi @almereyda, I can have a look if it's not much work 👍

@mattwoberts
Copy link
Contributor

@indyteo Hi!

Few years later.... is there much demand for this, I'm happy to review it if you want to rebase / merge from main, although I appreciate it's probably not the highest thing on your priority list right now :)

@indyteo
Copy link
Contributor Author

indyteo commented Sep 10, 2024

Hi @mattwoberts,

Let's be honest, I completely forgot about this one! 😄

I'd be happy to rebase (and btw clean that awful git history with all those merge commits...) so you can review. After a (very) quick review of the work that was done, I guess it shouldn't cause much trouble to rebase.
I'll handle this tomorrow that's on my todo-list ☑️

Thanks

@indyteo indyteo force-pushed the comment-link branch 2 times, most recently from a95b7d6 to b27f5a0 Compare September 10, 2024 15:56
@indyteo
Copy link
Contributor Author

indyteo commented Sep 10, 2024

@mattwoberts yay! 🎉

This should be up-to-date, ready to review! 😊
The git history is definitely cleaner too 😄

@mattwoberts
Copy link
Contributor

mattwoberts commented Sep 10, 2024 via email

Copy link
Contributor

@mattwoberts mattwoberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome stuff - some minor copy edit suggestions but all looks good!

locale/en/client.json Outdated Show resolved Hide resolved
locale/en/client.json Outdated Show resolved Hide resolved
locale/en/client.json Outdated Show resolved Hide resolved
@mattwoberts
Copy link
Contributor

In it comes :)

@mattwoberts mattwoberts merged commit a9c05c5 into getfider:main Sep 15, 2024
8 checks passed
@almereyda
Copy link

This is so nice and useful!

Looking forward to the next release.

@indyteo indyteo deleted the comment-link branch September 15, 2024 17:01
@indyteo
Copy link
Contributor Author

indyteo commented Oct 29, 2024

@almereyda it just got released to v0.23.0 😄🎉

@mattwoberts
Copy link
Contributor

@indyteo You beat me to it ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants